from newpro.db import db
from newpro.views.base import BaseHandler


class RolesHandler(BaseHandler):
    def get(self):
        sql = "select * from roles"
        res = db.findAll(sql)
        mes = [{'id': i['id'], 'name': i['name']} for i in res]
        self.finish({'code': 200, 'data': mes})
